package com.jonluo.service.config;

import com.jonluo.service.registry.ServiceRegistry;
import com.jonluo.service.registry.ServiceRegistryImpl;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "registry")
public class RegistryConfig {

  private String servers;

  private String name;

  public void setServers(String servers) {
    this.servers = servers;
  }

  public void setName(String name) {
    this.name = name;
  }

  @Bean
  public ServiceRegistry serviceRegistry() {
    return new ServiceRegistryImpl(name,servers);
  }


}
